Hi everyone, i want to abort an execution when the user clicks a button called "abort" on view_my_name DB box, then i expect it to destroy view_my_name DB and then to close module and destroy main DB as well. Actually it terminates very well the execution, but the problem is it aborts all including DOORS application! I receive the following error message saying that
" Microsoft Visual C++ Runtime Library
Runtime Error
Program:
This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information "
Thanks in advance to those who pay attention. Kind regards
PS: Below is the code that i use
*void aborter(DB my_box) {
hide(view_name_box)
destroy(view_name_box)
view_name_box = null
release(my_box)
close(m, false)
hide(my_box)
destroy(my_box)
my_box = null
halt
}*
SystemAdmin - Mon May 11 04:55:57 EDT 2009 |
|
Re: Abort a DXL application Peter_Albert - Mon May 11 05:34:13 EDT 2009
With only one callback routine I can only guess. But from your post I assume that 'aborter' is the callback routine of a button of the 'view_my_name' DB. If this is the case, then within 'void aborter', the two variables 'my_box' and 'view_name_box' are actually the same thing. And then you must get an error when you try to release a dialogue box which you have just destroyed.
Try releasing and destroying the main DB instead of my_box; the main DB must be defined as a global variable before the callback routine in order to be available.
Regards,
Peter
|
|
Re: Abort a DXL application SystemAdmin - Mon May 11 06:01:51 EDT 2009 Peter_Albert - Mon May 11 05:34:13 EDT 2009
With only one callback routine I can only guess. But from your post I assume that 'aborter' is the callback routine of a button of the 'view_my_name' DB. If this is the case, then within 'void aborter', the two variables 'my_box' and 'view_name_box' are actually the same thing. And then you must get an error when you try to release a dialogue box which you have just destroyed.
Try releasing and destroying the main DB instead of my_box; the main DB must be defined as a global variable before the callback routine in order to be available.
Regards,
Peter
Hi Peter,
yes you were right. After realizing the modifications that you've told me, i receive no more error messages, however this time event tough everyting goes as i want, the only problem, my_box which is the main box and at the same time which is declared globally, is not destroyed, and my screen gets frozen - also i should say that my_box should have been destriyed during the execution of the program.
void aborter(DB my_box) {
Module m = current
close(m, false)
hide(my_box)
destroy(my_box)
my_box = null
halt
}
|
|
Re: Abort a DXL application Peter_Albert - Mon May 11 10:17:09 EDT 2009 SystemAdmin - Mon May 11 06:01:51 EDT 2009
Hi Peter,
yes you were right. After realizing the modifications that you've told me, i receive no more error messages, however this time event tough everyting goes as i want, the only problem, my_box which is the main box and at the same time which is declared globally, is not destroyed, and my screen gets frozen - also i should say that my_box should have been destriyed during the execution of the program.
void aborter(DB my_box) {
Module m = current
close(m, false)
hide(my_box)
destroy(my_box)
my_box = null
halt
}
It is difficult to comment on the code fragment without knowing how you actually realized the two DBs, so here is a small example: It creates a main dialogue box with a button creating a second DB. The latter in turn has two buttons, one for exiting both DBs, and one for just closing the second one and returning to the main DB. Hope it helps,
Regards,
Peter
DB mainDB
DB childDB = null
void closeChild(DB db)
{
if (!null childDB){release childDB}
}
void closeAll(DB db)
{
closeChild(childDB)
if (!null mainDB){release mainDB}
}
void createChild(DB db)
{
childDB = create(mainDB, "child DB")
apply(childDB, "Abort", closeAll)
close(childDB, true, closeChild)
block childDB
}
mainDB = create "main DB"
apply(mainDB, "Create child DB", createChild)
block mainDB
|
|
Re: Abort a DXL application llandale - Mon May 11 12:17:44 EDT 2009 SystemAdmin - Mon May 11 06:01:51 EDT 2009
Hi Peter,
yes you were right. After realizing the modifications that you've told me, i receive no more error messages, however this time event tough everyting goes as i want, the only problem, my_box which is the main box and at the same time which is declared globally, is not destroyed, and my screen gets frozen - also i should say that my_box should have been destriyed during the execution of the program.
void aborter(DB my_box) {
Module m = current
close(m, false)
hide(my_box)
destroy(my_box)
my_box = null
halt
}
Frankly, I've never actually used 'destroy' for any of the 700 or so dialogs I've written. You don't need the 'halt', since the code has nowhere to go when the function is finished. Using 'm=current' is a mistake; there's no telling which module may be 'current'. Your main program needs to have a global variable specifying the module to which it applies, and you should close that. That is, put this at the top: "Module mCurr = current". Are you SURE you don't want to save the module? Wouldn't it be better to simply 'close(m)' it, and let DOORS prompt the user to save?
However, I don't see why the screen would freeze. My guess would be the 'destroy' function.
>Louie
|
|
Re: Abort a DXL application SystemAdmin - Mon May 11 13:05:46 EDT 2009 llandale - Mon May 11 12:17:44 EDT 2009
Frankly, I've never actually used 'destroy' for any of the 700 or so dialogs I've written. You don't need the 'halt', since the code has nowhere to go when the function is finished. Using 'm=current' is a mistake; there's no telling which module may be 'current'. Your main program needs to have a global variable specifying the module to which it applies, and you should close that. That is, put this at the top: "Module mCurr = current". Are you SURE you don't want to save the module? Wouldn't it be better to simply 'close(m)' it, and let DOORS prompt the user to save?
However, I don't see why the screen would freeze. My guess would be the 'destroy' function.
>Louie
Yes Louie, you're right about current module issue, perhaps you're right for the rest also. Actually, me too, i've figured out current module problem, simply i forgot it, i was a little bit hasty when i was writing down that code perhaps :$. One another thing that you're right is that the freeze of screen is definitely because of the destroy functions that i employed, however i cannot see the reason why. For the close function, notably, i should not let user to perform any save actions on modules, this is why i close them without saving, for the majority of users they have a such right to do it neither. In short, now i try to do it without "destroy" function but it does not behave exactly as i want... I do thank anyways to anyone who spared his time to answer my question.
|
|
Re: Abort a DXL application llandale - Mon May 11 18:01:20 EDT 2009 SystemAdmin - Mon May 11 13:05:46 EDT 2009
Yes Louie, you're right about current module issue, perhaps you're right for the rest also. Actually, me too, i've figured out current module problem, simply i forgot it, i was a little bit hasty when i was writing down that code perhaps :$. One another thing that you're right is that the freeze of screen is definitely because of the destroy functions that i employed, however i cannot see the reason why. For the close function, notably, i should not let user to perform any save actions on modules, this is why i close them without saving, for the majority of users they have a such right to do it neither. In short, now i try to do it without "destroy" function but it does not behave exactly as i want... I do thank anyways to anyone who spared his time to answer my question.
Well, I just read up on 'destroy'. Curious it says don't use it in a DBE callback (in the 'button' command). I notice your code is coded like the example. I wonder about setting "my_box" to null, since its a function parameter that is not 'call by reference', which would look like: void DoDestroy(DB &my_box), but that's illegal for a callback. Curious.
I never use destroy. I rarely have any kind of 'close' callback, I just use the default one.
Maybe someone can chime in here and tell us what 'destroy' really does. If we show 1000 dialogs and fail to delete them, are we wasting space in this session of DOORS?
>Louie
|
|